package com.fy.tt.executor.node.word.verb;

import com.alibaba.fastjson.JSONObject;
import com.fy.tt.executor.environment.Environment;

import java.util.List;

public class Have extends Verb{
    public String text;

    public Have(String text){
        this.text = text;
    }

    @Override
    public boolean run(String methodName) {
        boolean res = true;
        Object subject = Environment.environment.get("Subject");
        Object adverbial = Environment.environment.get("Adverbial");
        Object attribute = Environment.environment.get("Attribute");
        List<JSONObject>  obj = (List<JSONObject> )Environment.environment.get("Object");

        System.out.println("进入:有");

        if (subject != null && adverbial != null && attribute != null && obj != null){
            switch (obj.toString()){
                case "角色":
                    System.out.println("要拥有的角色类型" + attribute.toString());
                    break;
                default:
                    res = false;
                    break;
            }
        }else{
            if (obj.size()>0){
                System.out.println("obj.toString():"+obj.toString());
                System.out.println("有！");
                return true;
                }
            else{
                System.out.println("没有！");
                res = false;
            }

        }
        return res;
    }
}
